Skip to content

Conversation

house-ben
Copy link

@house-ben house-ben commented Sep 11, 2025

Fixed the contribution description for #1766

Since the heroes are based on the total donated_amount contributed, not the donations over the past year, the text has to be updated.

def display_django_heroes():
donors = DjangoHero.objects.for_public_display()
i = 0
for i, donor in enumerate(donors):
if (
donor.donated_amount is not None
and donor.donated_amount < LEADERSHIP_LEVEL_AMOUNT
):
break
return {
"corporate_members": CorporateMember.objects.by_membership_level(),
"leaders": donors[:i],
"heroes": donors[i:],
"inkind_donors": InKindDonor.objects.all(),
"display_donor_days": DISPLAY_DONOR_DAYS,
"display_logo_amount": int(LEADERSHIP_LEVEL_AMOUNT),
"corporate_membership_amounts": CORPORATE_MEMBERSHIP_AMOUNTS,
}

The fundraisers also have to have donated in the past year to show up

class DjangoHeroManager(models.Manager):
def for_public_display(self):
donors = (
self.get_queryset()
.filter(
is_visible=True,
approved=True,
donation__payment__date__gt=datetime.date.today()
- datetime.timedelta(days=DISPLAY_DONOR_DAYS),
)
.annotate(donated_amount=models.Sum("donation__payment__amount"))

@house-ben house-ben changed the title Update heroes donation limit text Update Leaders donation limit text Sep 11, 2025
@house-ben house-ben force-pushed the update-heroes-level-description branch from 8c8751b to 2b3f790 Compare September 11, 2025 20:31
@house-ben
Copy link
Author

I tried squashing my commits. I'm not familiar enough with git to understand how to get my two commits down to one. Anyone that can help?

Leadership-level donors contribute ${{ amount }} or
more in a calendar year.
Leadership-level donors contribute at least ${{ amount }}
and have donated in the last {{ display_donor_days }} days.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we want to have this displaying in the last 365 days. I think I'll prefer to say in the last calendar year instead.

Suggested change
and have donated in the last {{ display_donor_days }} days.
and have donated in the last calendar year.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thibaudcolas What do you think about this? Is the intention here to say 365 days explicitly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rechecked this, and the way we calculate this is indeed for the last 365 days. So, this change looks good to me.

Copy link
Member

@CuriousLearner CuriousLearner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌮

Great work @house-ben 🎉 Congrats on your first contribution!

Copy link
Contributor

@SaptakS SaptakS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@house-ben thanks for the PR! The code change makes sense to me. I will let the stakeholders give the final approval for the language change and to check if this PR fulfills the requirements.

cc @sabderemane @thibaudcolas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants